#pragma once

#include <QWidget>
#include "ui_VNavigationWidget.h"

class VNavigationWidget : public QWidget
{
	Q_OBJECT

public:
	VNavigationWidget(QWidget *parent = Q_NULLPTR);
	~VNavigationWidget();

	enum TYPE
	{
		SYMBOL	= 2,
		FILE	= 1,
	};

	struct NavigationData
	{
		int line;
		int type;
		QString path;
		QString name;
		NavigationData() {}
		NavigationData(QString path, int line, QString name, int type) {
			this->path = path;
			this->line = line;
			this->name = name;
			this->type = type;
		}
	};

	void update_content();

signals:
	void signal_navigation(QString input, int type);
	void signal_open_file(QString path);
	void signal_jump(QString path, int line);

public slots:
	void slot_set_navigation(QList<NavigationData*> list);
private:
	Ui::VNavigationWidget ui;
	NavigationData* get_item_data(QListWidgetItem *item);
	QString get_icon(int type);
	bool eventFilter(QObject* watched, QEvent* event);
	void init_connect();
	void select_item(QListWidgetItem *item);
};
